package com.doyled.jump.window;

import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.doyled.jump.framework.SceneManager;
import com.doyled.jump.scene.GameScene;
import com.doyled.jump.scene.MenuScene;
import com.doyled.jump.util.ChessKind;
import com.doyled.jump.util.SceneKind;

public class Window {
	public Window(int w, int h, String title){
		
		MenuScene menuScene = new MenuScene();
		menuScene.setPreferredSize(new Dimension(w, h));
		menuScene.setMaximumSize(new Dimension(w, h));
		menuScene.setMinimumSize(new Dimension(w, h));
		
		GameScene gameScene = new GameScene();
		gameScene.setPreferredSize(new Dimension(w, h));
		gameScene.setMaximumSize(new Dimension(w, h));
		gameScene.setMinimumSize(new Dimension(w, h));
		
		JPanel noneJPanel = new JPanel();
		noneJPanel.setLayout(new CardLayout());
		noneJPanel.setPreferredSize(new Dimension(w, h));
		noneJPanel.setMaximumSize(new Dimension(w, h));
		noneJPanel.setMinimumSize(new Dimension(w, h));
		noneJPanel.add(menuScene, "Menu Scene");
		noneJPanel.add(gameScene, "Game Scene");
		
		JFrame frame = new JFrame(title);
		frame.setPreferredSize(new Dimension(w, h));
		frame.setMaximumSize(new Dimension(w, h));
		frame.setMinimumSize(new Dimension(w, h));
		frame.add(noneJPanel);
		frame.pack();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setResizable(false);
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);
		
		SceneManager.initSceneManager(noneJPanel);
		SceneManager.getInstanse().setMenuScene(menuScene);
		SceneManager.getInstanse().setGameScene(gameScene);
		
		SceneManager.getInstanse().setMenuScene("Menu Scene");
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Window(700, 710, "Co Ca Ngua");
	}
}
